﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Base.cs" company="DHGMS Solutions">
//   Copyright 2004-2014 DHGMS Solutions.
//      
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//      
//   http://www.apache.org/licenses/LICENSE-2.0
//      
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
// <summary>
//   JobBase provider for Tasks
//   Used for handling how IO's are handled
//   Allows for the IO's to be changed without recoding the core program on a per-program basis
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Dhgms.TplHelper.Model.Provider.Job
{
    using System;

    /// <summary>
    /// JobBase provider for Tasks
    /// Used for handling how IO's are handled
    /// Allows for the IO's to be changed without recoding the core program on a per-program basis
    /// </summary>
    /// <typeparam name="TJobResultClass">
    /// </typeparam>
    public abstract class JobMonitoringBase<TJobResultClass> : Dhgms.DataManager.Model.Provider.Base
        where TJobResultClass : Info.JobResult.Base, new()
    {
        #region Public Methods and Operators

        /// <summary>
        /// Handles sending of error information to different mediums
        /// </summary>
        /// <param name="jobGuid">
        /// Unique GUID used to identify job
        /// </param>
        /// <param name="jobName">
        /// Friendly name of job
        /// </param>
        /// <param name="e">
        /// Exception message
        /// </param>
        public abstract void OnJobFailure(Guid jobGuid, string jobName, Exception e);

        /// <summary>
        /// Notify the provider of a job start
        /// </summary>
        /// <param name="jobGuid">
        /// Unique ID of the job
        /// </param>
        public abstract void OnJobStart(Guid jobGuid);

        /// <summary>
        /// The on job sucess.
        /// </summary>
        /// <param name="jobGuid">
        /// Unique GUID used to identify program
        /// </param>
        /// <param name="jobName">
        /// Friendly name of program
        /// </param>
        /// <param name="taskResult">
        /// Run results of task
        /// </param>
        public abstract void OnJobSucess(Guid jobGuid, string jobName, TJobResultClass taskResult);

        /// <summary>
        /// Handles the sending of a task failure notification, if required
        /// </summary>
        /// <param name="taskGuid">
        /// The GUID relating to the task
        /// </param>
        /// <param name="e">
        /// Exception message
        /// </param>
        public abstract void OnTaskFailure(Guid taskGuid, Exception e);

        /// <summary>
        /// Handles the sending of a task start notification, if required
        /// </summary>
        /// <param name="taskGuid">
        /// The GUID relating to the task
        /// </param>
        public abstract void OnTaskStart(Guid taskGuid);

        /// <summary>
        /// Handles the sending of a task completion notification, if required
        /// </summary>
        /// <param name="taskGuid">
        /// The GUID relating to the task
        /// </param>
        public abstract void OnTaskSucess(Guid taskGuid);

        #endregion
    }
}